<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><%@include file="/include/public.jspf"%>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="Cache-Control" content="no-cache" />
<meta name="format-detection" content="telephone=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1,user-scalable=no" />
<link rel="stylesheet" type="text/css" href="${path }/css/default/m-base.css" />
<link rel="stylesheet" type="text/css" href="${path }/css/default/m-common.css" />
<link rel="stylesheet" type="text/css" href="${path }/css/default/p-all.css" />
<script type="text/javascript" src="${path }/js/jquery1.10.2.min.js"></script>
<script type="text/javascript" src="${path }/js/lib/zepto.js"></script>
<script type="text/javascript" src="${path }/js/common/base.js"></script>
<script type="text/javascript" src="${path }/js/lib/lib.js"></script>

<title>魔环金融</title>
</head>
<body>
<div class="ui_title">
        <a class="ui_back" href="javascript:void(0)" onclick="window.history.back();"><i class="ui_icon_back"></i>返回</a>
        合同列表</div>
    <div class="p_contract">
        <div class="JS-contract_list mt10"></div>
        <div class="JS-loadmore ui_loadmore_text">
            <a href="javascript:void(0);">点击加载更多</a>
        </div>
    </div>
    <script>
        var contactList = new P2PWAP.ui.P2PLoadMore($(".p_contract .JS-contract_list")[0], $('.JS-loadmore')[0], '/account/ajax_contract', 1);
        contactList.createItem = function(item) {
            var div = document.createElement("dl");
            div.className = 'big_list';
            var html = '';
            html += '<dt>';
            html +=   '<h2>' + item["dealName"] + '</h2>';
            html +=   '<p>融资人：' + item["userRealName"] + '    总额：' + (parseInt(item["borrowAmount"]) / 10000).toFixed(2) + '万</p>';
            html +=   '<p>利率：' + item["incomeFeeFormat"] + '%  ' + item["period"] + '  ' + item["loanTypeName"] + '</p>';
            html += '</dt>';
            html += '<dd>';
            if(item["isHaveSign"] == "0") {
                html += '<a href="javascript:;" class="btn_signed JS-signContract" data-id=' + item["dealId"] + ' id="a' + item["dealId"] + '">一键签署</a>';
            } else {
                html += '<span class="btn_signed btn_dis">已签署</span>';
            }
            html += '</dd>';
            div.innerHTML = html;
            $(div).find('.JS-signContract').bind('click', function(){
                showConfirmDialog(item["dealId"], function() {
                    $(div).find("dd").html('<span class="btn_signed btn_dis">已签署</span>');
                    window.location.reload();
                });
                return false;
            });
            div.onclick = function() {
                window.location.href = "/account/contlist?id=" + item["dealId"];
            };
            return div;
        }
        var _contactFirstpage = [];
        contactList.preloadPage(_contactFirstpage,1);
    </script>
</body>
</html>